package com.dj.domain.exception;

/**
 * 业务异常基类
 * 
 * @author jasen.hsu.cn@gmail.com 2012-4-17 下午9:49:21
 */
public class DaijiaServiceException extends Exception {

    private static final long serialVersionUID = 7885967386903492545L;
    protected String          message          = null;
    protected String          codeType         = null;

    public DaijiaServiceException(){
        super();
    }

    public DaijiaServiceException(String errorCode){
        super();
        this.codeType = errorCode;
    }

    /**
     * @param message 错误消息
     * @param codeType 错误编码
     */
    public DaijiaServiceException(String message, String codeType){
        super();
        this.message = message;
        this.codeType = codeType;
    }

    /**
     * @param message 错误消息
     * @param codeType 错误编码，业务相关
     */
    public DaijiaServiceException(String message, String codeType, Throwable cause){
        super(cause);
        this.message = message;
        this.codeType = codeType;
    }

    /**
     * @param codeType 业务code类型定义.
     * @param cause
     */
    public DaijiaServiceException(Throwable cause){
        super(cause);
    }

    @Override
    public String getMessage() {
        if (this.message == null) return super.getMessage();
        return this.message;
    }

    /**
     * @return 返回业务Code类型码
     */
    public String getCodeType() {
        return codeType;
    }
}
